package com.ef.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.ef.dao.CorpPayDao;
import com.ef.domain.CorpContract;
import com.ef.domain.CorpPayHistory;

public class CorpPayDaoImpl extends DaoImpl<CorpPayHistory> implements CorpPayDao {

	public List<CorpPayHistory> findByContract(CorpContract contract) {
		DetachedCriteria criterion = DetachedCriteria
				.forClass(CorpPayHistory.class);
		criterion.createCriteria("contract").add(
				Restrictions.eq("id", contract.getId()));
		criterion.addOrder(Order.asc("payTime"));
		return  findAllByCriteria(criterion);
 	}
}
